home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ORBit.idb / usr / freeware / include / orb / cdr.h.z / cdr.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  3.1 KB  |  78 lines

  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
  2.  
  3. /*
  4.  *  ORBit: A CORBA v2.2 ORB
  5.  *
  6.  *  Copyright (C) 1998 Richard H. Porter
  7.  *
  8.  *  This library is free software; you can redistribute it and/or
  9.  *  modify it under the terms of the GNU Library General Public
  10.  *  License as published by the Free Software Foundation; either
  11.  *  version 2 of the License, or (at your option) any later version.
  12.  *
  13.  *  This library is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  *  Library General Public License for more details.
  17.  *
  18.  *  You should have received a copy of the GNU Library General Public
  19.  *  License along with this library; if not, write to the Free
  20.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  *  Author: Dick Porter <dick@cymru.net>
  23.  *
  24.  */
  25.  
  26. #ifndef _ORBIT_CDR_H_
  27. #define _ORBIT_CDR_H_
  28.  
  29. #include "orbit_types.h"
  30.  
  31. typedef enum {
  32.     BigEndian=0,
  33.     LittleEndian=1
  34. } CDR_Endianness;
  35.  
  36. typedef struct {
  37.     CDR_Endianness host_endian;
  38.     CDR_Endianness data_endian;
  39.     CORBA_octet *buffer;
  40.     unsigned int buf_len;
  41.     unsigned int wptr, rptr;
  42.     CORBA_boolean readonly;
  43.     CORBA_boolean release_buffer;
  44. } CDR_Codec;
  45.  
  46. #define HEXDIGIT(c) (isdigit((guchar)(c))?(c)-'0':tolower((guchar)(c))-'a'+10)
  47. #define HEXOCTET(a,b) ((HEXDIGIT((a)) << 4) | HEXDIGIT((b)))
  48.  
  49. extern CDR_Codec *CDR_codec_init(void);
  50. extern CDR_Codec *CDR_codec_init_static(CDR_Codec *codec);
  51. extern void CDR_codec_free(CDR_Codec *);
  52.  
  53. extern void CDR_put_short(CDR_Codec *codec, CORBA_short s);
  54. extern void CDR_put_ushort(CDR_Codec *codec, CORBA_unsigned_short us);
  55. extern void CDR_put_long(CDR_Codec *codec, CORBA_long l);
  56. extern void CDR_put_ulong(CDR_Codec *codec, CORBA_unsigned_long ul);
  57. #ifdef HAVE_CORBA_LONG_LONG
  58. extern void CDR_put_long_long(CDR_Codec *codec, CORBA_long_long ll);
  59. extern void CDR_put_ulong_long(CDR_Codec *codec, CORBA_unsigned_long_long ull);
  60. #endif
  61. extern void CDR_put_float(CDR_Codec *codec, CORBA_float f);
  62. extern void CDR_put_double(CDR_Codec *codec, CORBA_double d);
  63. extern void CDR_put_long_double(CDR_Codec *codec, CORBA_long_double ld);
  64. extern void CDR_put_octet(CDR_Codec *codec, CORBA_octet datum);
  65. extern void CDR_put_octets(CDR_Codec *codec, void *data, unsigned long len);
  66. extern void CDR_put_char(CDR_Codec *codec, CORBA_char c);
  67. extern void CDR_put_boolean(CDR_Codec *codec, CORBA_boolean datum);
  68. extern void CDR_put_string(CDR_Codec *codec, const char *str);
  69. extern CORBA_boolean CDR_buffer_gets(CDR_Codec *codec, void *dest, const unsigned int len);
  70. extern CORBA_boolean CDR_get_ushort(CDR_Codec *codec, CORBA_unsigned_short *us);
  71. extern CORBA_boolean CDR_get_ulong(CDR_Codec *codec, CORBA_unsigned_long *ul);
  72. extern CORBA_boolean CDR_get_octet(CDR_Codec *codec, CORBA_octet *datum);
  73. extern CORBA_boolean CDR_get_string(CDR_Codec *codec, CORBA_char **str);
  74. extern CORBA_boolean CDR_get_string_static(CDR_Codec *codec, CORBA_char **str);
  75. extern CORBA_boolean CDR_get_seq_begin(CDR_Codec *codec, CORBA_unsigned_long *ul);
  76.  
  77. #endif /* !_ORBIT_CDR_H_ */
  78.